<template>
  <div ref="chart" style="width: 100%; height: 400px;"></div>
</template>

<script>
import echarts from 'echarts'

export default {
  name: 'CustomerCharts',
  props: ['addData'],
  data () {
    return {
      customerAddData: {
        labels: ['2023-7-1', '2023-7-2', '2023-7-3', '2023-7-4', '2023-7-5', '2023-7-6', '2023-7-7'],
        values: [8, 9, 9, 9, 1, 1, 1]
      }
    }
  },
  mounted () {
    this.renderChart()
  },
  methods: {
    renderChart () {
      const chart = echarts.init(this.$refs.chart)
      chart.setOption({
        title: {
          top: '20',
          show: true,
          text: '客户新增统计',
          left: 'center'
        },
        xAxis: {
          type: 'category',
          data: this.addData.labels
        },
        yAxis: {
          type: 'value'
        },
        series: [
          {
            data: this.addData.values,
            type: 'line',
            smooth: true
          }
        ]
      })
    }
  }
}
</script>
